﻿using System.Reflection;

namespace BlogSystem.Common.Util;

public  static class AssemblyHelper
{
    public static Assembly GetAssemblyByNamespace(string namespaceString)
    {
        // 获取当前域的 所有程序集
        var assemblies = AppDomain.CurrentDomain.GetAssemblies();
        foreach (var assembly in assemblies)
        {  // 获取所以的类型
            var types = assembly.GetTypes();
            if (types.Any(t => t.Namespace == namespaceString))
            {
                return assembly;
            }
        }
        return null;
    }
}